﻿<%@ Page Language="C#" MasterPageFile="~/Masterlayout.master" AutoEventWireup="true" CodeFile="Products.aspx.cs" Inherits="Products" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<title>Products Pages</title>
    <style>
    .stylebtn
      {
      	border-width:1px;
      	height: 35px;
      	width:100px;
      }
    .tb5 {
	        border:2px solid #456879;
	        border-radius:10px;
	        height: 22px;
	        width: 230px;
             margin-left: 0px;
            
          }
    .gv
        {
        	border:2px solid #456879;
	        border-radius:20px;
	        width:742px;
	
        }
        </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <center>
        <table style = "width: 660px">
        <tr align ="left">
            <td width = "120px">
                Product ID:
            </td>
            <td>
                <asp:TextBox ID="txtProductID" runat="server" ReadOnly="true" class="tb5"></asp:TextBox>
            </td>
        </tr>
        
        <tr align="left">
            <td>
                Product Name:
            </td>
            <td>
                <asp:TextBox ID="txtProductName" runat="server" class="tb5"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ErrorMessage="Enter Product Name" ControlToValidate="txtProductName">
                    </asp:RequiredFieldValidator>
            </td>
        </tr>
        
        <tr align="left">
            <td>
                Supplier ID:
            </td>
            <td>
                <asp:DropDownList ID="ddlSupplierID" runat="server" class="tb5">
                </asp:DropDownList>
                <asp:CompareValidator ID="suppliervalidator" runat="server" 
                    ControlToValidate="ddlSupplierID" ErrorMessage="CompareValidator" 
                    Operator="NotEqual" ValueToCompare="Please Select Supplier"></asp:CompareValidator>
            </td>
        </tr>
        
        <tr align="left">
            <td>
                Category ID:
            </td>
            <td>
                <asp:DropDownList ID="ddlCategoryID" runat="server" AutoPostBack="false" class="tb5">
                </asp:DropDownList>
                <asp:CompareValidator ID="categoryvalidator" runat="server" 
                    ControlToValidate="ddlCategoryID" ErrorMessage="CompareValidator" 
                    Operator="NotEqual" ValueToCompare="Please Select Category"></asp:CompareValidator>
            </td>
        </tr>
        
        <tr align="left">
            <td>
                Unit Price:
            </td>
            <td>
                <asp:TextBox ID="txtUnitPrice" runat="server" class="tb5"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="txtUnitPrice" ErrorMessage="Enter Unit Price"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                    ControlToValidate="txtUnitPrice" ErrorMessage="Wrong Format" 
                    ValidationExpression="(^(\.[1-9])?$|(^[1-9][0-9]{0,2}?(\.[1-9])?$))$"></asp:RegularExpressionValidator>
            </td>
        </tr>
        
        <tr align="left">
            <td>
                Discontinued:
            </td>
            <td>
                <asp:CheckBox ID="cbDiscontinued" runat="server" />
            </td>
        </tr>
        
        <tr align="left">
            <td colspan = "5">
                <asp:Button ID="btnInsert" runat="server" Text="Insert" Width="115px" 
                    class="tb5" onclick="btnInsert_Click" />&nbsp;
                <asp:Button ID="btnUpdate" runat="server" Text="Update" Width="115px" 
                    onclick="btnUpdate_Click" class="tb5"/>&nbsp;
                <asp:Button ID="btnDelete" runat="server" Text="Delete" Width="115px" 
                    onclick="btnDelete_Click" class="tb5"/>&nbsp;
                <asp:Button ID="btnClearProduct" runat="server" Text="Clear" Width="115px" 
                     CausesValidation="False" onclick="btnClearProduct_Click" class="tb5"/>&nbsp; 
                <asp:Button ID="btnLoadProduct" runat="server" 
                    Text="LoadProduct" CausesValidation="False" 
                    onclick="btnLoadProduct_Click" Width="115px" class="tb5"/>
            </td>
        </tr>
        
        <tr align="center">
            <td colspan = "5">
                <asp:TextBox ID="txtSearch" runat="server" class="tb5"></asp:TextBox>&nbsp;
                <asp:Button ID="btnSearch" runat="server" Text="Search" Width = ""
                    CausesValidation="False" class="tb5" onclick="btnSearch_Click" />&nbsp;
            </td>
        </tr>
        
        </table>
        </center>
        <br />
        
        <asp:GridView ID="GridViewProduct" runat="server" Width="1000px" style="margin-left:60px"
            BackColor="White"
            ForeColor="Black"
            AllowPaging="True"
            PageSize="10" 
            CellPadding="4" 
            GridLines="None"
            AutoGenerateSelectButton="True"
            onpageindexchanging="GridViewProduct_PageIndexChanging" 
            onselectedindexchanged="GridViewProduct_SelectedIndexChanged">
            
            <HeaderStyle BackColor="Orange" />
        <EditRowStyle ForeColor="Black" />
        <AlternatingRowStyle BackColor="DarkGray" />
        <SelectedRowStyle BackColor="BlueViolet" />
        </asp:GridView>
    </asp:Content>